/**
 * @file xceed.c
 * @brief xceed, the minimalist tiling window manager in C.
 * @author Guo-Rong Koh
 * @date 25 February 2008
 *
 * @par Copyright Notice
 * Copyright Guo-Rong Koh 2008.
 */

/*
 * This file is part of xceed.
 *
 * xceed is free software: you can redistribute it and/or modify it under the
 * terms of the GNU General Public License Version 2 as published by the Free
 * Software Foundation.
 *
 * xceed is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * xceed.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <X11/Xlib.h>

#include <stdio.h>
#include <stdlib.h>

#include "xcd_x11.h"

int main (void)
{
    Display     *display = NULL;
    xcd_head_t  *heads   = NULL;
    int          count   = 0;

    display = xcd_x11_init();
    if (display == NULL)
        return -1;

    fprintf(stdout, "Welcome to xceed!\n");

    heads = xcd_x11_get_heads(display, &count);

    if (heads != NULL)
    {
        int i = 0;

        for (i = 0; i < count; i++)
        {
            fprintf(stdout, "head %d: %hdx%hd\n",
                    i,
                    heads[i].resolution.width,
                    heads[i].resolution.height);
        }

        xcd_x11_free_heads(heads);
    }

    while (1)
    {
        XEvent event;

        /* check return */
        XNextEvent(display, &event);

        fprintf(stderr, "%d\n", event.type);
    }

    xcd_x11_exit(display);

    return 0;
}
